/*
 * Tezad - Classic puzzle game
 * Copyright 2009 Shayne Riley and Paul Maseberg
 *
 * Tezad is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tezad is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tezad.  If not, see <http://www.gnu.org/licenses/>
 * or write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * To contact the authors on questions or issues regarding the license,
 * you may send an email to <pezads at gmail dot com>
 */

#ifndef COMMANDACTIONS_H_
#define COMMANDACTIONS_H_

/**
 * Performs the actions from the commands. That is, these are the methods that
 * are called from the game commands.
 *
 * Note, though, that we don't receive any objects of type Command. That is
 * because whatever implements this class will be passed to the Command, and
 * Command will then call whatever function it needs. Bam!
 */
class CommandActions
{
public:
    virtual ~CommandActions();

    /// The player (human or AI) wants to shift the active mino left.
    /// @param pressed  True: button was just pressed. False: just released.
    virtual void inputReqShiftLeft(bool pressed);

    /// The player (human or AI) wants to shift the active mino right.
    /// @param pressed  True: button was just pressed. False: just released.
    virtual void inputReqShiftRight(bool pressed);

    /// The player (human or AI) wants to shift the active mino down.
    /// @param pressed  True: button was just pressed. False: just released.
    virtual void inputReqSoftDown(bool pressed);

    /// The player (human or AI) wants to shift the active mino down to the
    /// lowest position in the well and set the mino.
    virtual void inputReqHardDown();

    /// The player (human or AI) wants to rotate the active mino
    /// counter-clockwise.
    virtual void inputReqRotateCCW();

    /// The player (human or AI) wants to rotate the active mino clockwise.
    virtual void inputReqRotateCW();

    /// Perform the shift left.
    virtual void shiftLeft();

    /// Perform the shift right.
    virtual void shiftRight();

    /// Perform the soft down shift.
    virtual void softDown();

    /// Perform the hard down action.
    virtual void hardDown();

    /// Perform the gravity down action.
    virtual void gravityDown();

    /// Perform the gravity down action.
    virtual void shiftUp();

    /// Perform the counter-clockwise rotation of the active mino.
    virtual void rotateCCW();

    /// Perform the clockwise rotation of the active mino.
    virtual void rotateCW();

    /// Perform the set mino action.
    virtual void setMino();

    /// Perform the new mino action.
    /// @param minoNum 0-6 represents I, J, L, O, S, T, Z.
    virtual void newMino(int minoNum);

    /**
     * Clear the indicated rows in the well.
     * @param rows  An array of the rows to clear.
     * @param numRows   The number of elements in the array. Must not be bigger
     * than 4.
     */
    virtual void clearRows(const int rows[], int numRows);

    /// Perform the set Speed action.
    /// @param, the speed specifier to set to. Must be between 0-20.
    virtual void setSpeed(int speed);

    /**
     * Performs the the initialize game action, specifying the desired
     * width, height, hidden height, starting row and column of the origin
     * brick of the minos when they get introduced to the well, and starting
     * speed.
     * @param width The width of the well. Must be greater than or equal to 4.
     * @param totalHeight The height of the well. Must be greater or equal to 4.
     * @param hiddenHeight  The portion of the well that is hidden. Must be
     * greater or equal to 0, and cannot be equal to the total height of the
     * well.
     * @param startRow  The starting row of the origin brick of each new mino.
     *  Must be located within the confines of the well, and at least one row
     *  down from the top of the well, and two rows up from the bottom.
     *  Remember, row numbers go from 1 at the bottom to n at the top, so you
     *  would want it at n - 1, most likely.
     * @param startCol  The starting column of the origin brick of each new
     * mino. Must be at least one column in from the left, and two columns in
     * from the right. Column numbers for from 1 at the left to n at the right.
     * @param startSpeed    The starting speed of the mino decent. Must be
     * between 0-20.
     */
    virtual void initGame(int width, int totalHeight, int hiddenHeight,
            int startRow, int startCol, int startSpeed);

protected:
    CommandActions(); // Why do I make this protected again? Why not private?
};

#endif /* COMMANDACTIONS_H_ */
